home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / plug-ins / perl / examples / example-oo < prev    next >
Encoding:
Text File  |  2000-08-24  |  871 b   |  38 lines

  1. #!/usr/bin/perl
  2.  
  3. # this extension shows some oo-like calls
  4.  
  5. # it's really easy
  6.  
  7. use Gimp;
  8.  
  9. # the extension that's called.
  10. sub plug_in_example_oo {
  11.   my $img=new Image(300,200,RGB);
  12.  
  13.   my $bg=new Layer($img,300,200,RGB_IMAGE,"Background",100,NORMAL_MODE);
  14.  
  15.   Palette->set_background([200,200,100]);
  16.  
  17.   $bg->fill(BG_IMAGE_FILL);
  18. #  Palette->set_background([200,100,200]);
  19. #  gimp_drawable_fill ($bg,BG_IMAGE_FILL);
  20.   $img->add_layer($bg,1);
  21.  
  22.   new Display($img);
  23. }
  24.  
  25. Gimp::on_run {
  26.   plug_in_example_oo;
  27. };
  28.  
  29. Gimp::on_query {
  30.   gimp_install_procedure("plug_in_example_oo", "a test plug-in in perl",
  31.                          "try it out", "Marc Lehmann", "Marc Lehmann", "1998-04-27",
  32.                          N_"<Toolbox>/Xtns/Perl Example Plug-in", undef, EXTENSION,
  33.                          [[PDB_INT32, "run_mode", "Interactive, [non-interactive]"]], []);
  34. };
  35.  
  36. exit main;
  37.  
  38.